package net.apexes.demo.codegen.ormlite.column;

import net.apexes.commons.ormlite.Column;
import net.apexes.commons.ormlite.Index;
import net.apexes.demo.codegen.ormlite.column.base.QEntityBase;
import net.apexes.demo.codegen.ormlite.entity.GoodsGroup;

/**
 * QGoodsGroup is a ORMLite query type for GoodsGroup
 * @see GoodsGroup
 */
public class QGoodsGroup extends QEntityBase<GoodsGroup> {

    public static final QGoodsGroup $ = new QGoodsGroup("GOODS_GROUP");

    public final Column name = field("name").columnName("NAME").varchar(32).notNull().build();

    public final Column seqOrder = field("seqOrder").columnName("SEQ_ORDER").integer().notNull().build();

    public final Column templateId = field("templateId").columnName("TEMPLATE_ID").varchar(22).notNull().build();

    public class Indexs {

        public final Index primaryKeyD3 = index("PRIMARY_KEY_D3").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QGoodsGroup(String tableName) {
        super(GoodsGroup.class, tableName);
    }

    @Override
    public GoodsGroup newInstance() {
        return new GoodsGroup();
    }

    @Override
    public Object getFieldValue(GoodsGroup instance, String fieldName) {
        switch (fieldName) {
            case "name":
                return instance.getName();
            case "seqOrder":
                return instance.getSeqOrder();
            case "templateId":
                return instance.getTemplateId();
            default:
                return super.getFieldValue(instance, fieldName);
        }
    }

    @Override
    public void setupFieldValue(GoodsGroup instance, String fieldName, Object value) {
        switch (fieldName) {
            case "name":
                instance.setName((java.lang.String) value);
                break;
            case "seqOrder":
                instance.setSeqOrder((java.lang.Integer) value);
                break;
            case "templateId":
                instance.setTemplateId((java.lang.String) value);
                break;
            default:
                super.setupFieldValue(instance, fieldName, value);
                break;
        }
    }

}

